w
Or is there a good place in the source code to cross reference to learn from?
@Kevin Jump did you use any of these yet in your work?
m
In general, docs lacks behind. My go to "source" is the source code on github, I've also found the preview source of Workflow to a good place for inspiration for bigger packages
w
Seems like @nathanwoulfe is just using normal modals without routes from what I can tell looking through repo
m
I did som POC work this weekend and it's quite easy once you get your head around it
You basically need something to "host" the route (think of this as the same page that would open it with a button), it's even possible to have routes inside the modal
w
Yeh not had time to sit down and give it a proper go. Got anything you could point me to @Markus Johansson ?
m
I kind of have a repo with demos but it not really "ready" for sharing publicly, however, I extracted the routed modal part here: https://www.dropbox.com/scl/fi/tfxbbhjgr6wvt81x7nyyy/modal-with-route.zip?rlkey=7zec57jafbhrmqyabwtys43uo&dl=0
w
Thanks really appreciate that
Gotta love this community - all helping one another as we figure this out together
Is the pattern to open a modal with a route just to use a link to it as in your example Markus or do I call
.open()
instead?
m
I think that the example might be misleading in that I started out with a regular modal that I opened using the MODAL_CONTEXT and .open(). Then I "converted" that modal into a routed modal. As of my understanding a "modal route" should be opened with a link (like a ) but to be honest that is just my interpretation - no official source 😄
w
Yeh that’s my understanding, but also see there is an .open() method available.
For me I have no UI to launch the modal from a link. As entity action has the execute method. Which is what happens when you click the entity action item.
Will see if I get hacking time this evening to investigate 🤔
Hmm there is getHref on entityAction
OK I need some help, as I really can't piece the puzzle together with this one...
So what am I doing wrong?! /cc @Niels Lyngsø or @Jacob Overgaard if your not on Easter holidays
n
Hi Warren, I would not recommend using Routable Modals in entity actions.. also there is a few mistakes, one I can clearly see is that the 'UniquePaths' (addUniquePaths) are never begin defined.. they should be set before the modal can be routed.
w
Hiya I thought I had a good use case On wanting to share/deep link directly to my modal that contains information specific to a certain content node.
Also I am not sure I understand the mistake your saying. > One I can clearly see is that the 'UniquePaths' (addUniquePaths) are never begin defined.. they should be set before the modal can be routed. This line is set./copied from docs (again no clue) what I am doing
.addUniquePaths(['propertyAlias', 'variantId'])
Curious to know what places are deemed OK to use Routed Modals ?
m
@Warren Buckley I think that the idea with a Routed Modal is that something (another element like a sectionView, collectionView, workspaceView) needs to "host" the modal route. So let say we have a sectionview /umbraco/my-section/view/my-section-view/ that host a modal, the modal route would be something like /umbraco/my-section/view/my-section-view/modal/my-modal/{:param1}/{:param2} without the hosting element the "base route" would not exists. I have not played with entity actions so I don't know if there is any way to get your hands on a "hosting" element inside the content section? It might be exposed on some workspace context or something? I think Niels is trying to say that the onSetup method does not return the "right" parameters to the modal. The return from that methods should basically grab the parameters from the route and return them in the format that the modal expects. So "onSetup" can be seen as the "routed version" of "open". Not sure why an entity action is not recommended to use a modal, many of the other entity actions like, create, sort etc. uses a sidebar modal.
(also: I might be totally wrong haha 😄 )
w
Ok think will park this for now then 😦
n
Well, this would really require some Documentation and some love and care on the DX perspective, ideally the techincal parts was hidden more away, cause at the current stage there is a bit of pluming to get it up and running.. and specially for entity actions, the problem is that the Routable Modal can only be within other Routable Modals and not in a non-routeable. as well they need to extend the URL, where the tree is in a place in the DOM where it does not contain all of the Paths, like the workspace etc. is deeper ind the DOM.
w
OK seems a bit of a minefield. I will just accept for now that entity action with a routable modal is not the thing to do right now. But yeh seems a lot of moving parts, plumbing, as curious how the router/routing works but ended up going down a minefield and not really get any of it. Thanks all
3 Views